﻿using Microsoft.AspNetCore.Mvc;
using Nasty.Core.LoadParams;
using Nasty.Core.Registry;
using Nasty.SystemModule.Areas.Dictionary.Model;
using Nasty.SystemModule.Areas.Dictionary.Params;
using NetTaste;

namespace Nasty.SystemModule.Dictionary
{
	public interface IDictionaryService : IAutofacRegister
	{
		public Nasty.Core.Entity.System.Dictionary GetDictionary(string id);

		public List<Nasty.Core.Entity.System.Dictionary> GetDictionarys(GetDictionarysParams @params);

        public ResultData<Nasty.Core.Entity.System.Dictionary> SaveDictionary(DictionaryModel model);

		public ResultData<string> DeleteDictionarys(List<string> ids);


        public PageData<Nasty.Core.Entity.System.Dictionary> GetDictionaryPage(GetDictionaryPageParams @params);
    }

	public class DictionaryService : IDictionaryService
	{
		public required IDictionaryRepository DictionaryRepository { get; set; }

		public ResultData<string> DeleteDictionarys(List<string> ids)
		{
			return DictionaryRepository.DeleteDictionarys(ids);
		}

		public Nasty.Core.Entity.System.Dictionary GetDictionary(string id)
		{
			return DictionaryRepository.GetDictionary(id);
		}

        public PageData<Nasty.Core.Entity.System.Dictionary> GetDictionaryPage(GetDictionaryPageParams @params)
        {
            return DictionaryRepository.GetDictionaryPage(@params);
        }

        public ResultData<Nasty.Core.Entity.System.Dictionary> SaveDictionary(DictionaryModel model)
		{
			return DictionaryRepository.SaveDictionary(model);
		}

        public List<Nasty.Core.Entity.System.Dictionary> GetDictionarys(GetDictionarysParams @params)
        {
            return DictionaryRepository.GetDictionarys(@params);
        }
    }
}
